package com.wanlian.jpush.sms.vo;

import java.util.HashMap;
import java.util.Map;

public class StatusCodeMap {
	private static Map<Integer, StatusError> errormap;

	static {
		errormap = new HashMap<Integer, StatusError>();
		errormap.put(50001, new StatusError(50001, "missing auth", "auth 为空"));
		errormap.put(50002, new StatusError(50002, "auth failed", "auth 鉴权失败"));
		errormap.put(50003, new StatusError(50003, "missing body", "body 为空"));
		errormap.put(50004, new StatusError(50004, "missing mobile", "手机号为空"));
		errormap.put(50005, new StatusError(50005, "missing temp_id", "模版ID 为空"));
		errormap.put(50006, new StatusError(50006, "invalid mobile", "手机号无效"));
		errormap.put(50007, new StatusError(50007, "invalid body	body", " 无效"));
		errormap.put(50008, new StatusError(50008, "no sms code auth", "没有短信业务权限"));
		errormap.put(50009, new StatusError(50009, "out of freq", "发送超频"));
		errormap.put(50010, new StatusError(50010, "invalid code", "验证码无效"));
		errormap.put(50011, new StatusError(50011, "expired code", "验证码过期"));
		errormap.put(50012, new StatusError(50012, "verified code", "验证码已验证过"));
		errormap.put(50013, new StatusError(50013, "invalid temp_id", "模版ID 无效"));
		errormap.put(50014, new StatusError(50014, "no money", "余额不足"));
		errormap.put(50015, new StatusError(50015, "missing code", "验证码为空"));
		errormap.put(50016, new StatusError(50016, "api not found", "API 不存在"));
		errormap.put(50017, new StatusError(50017, "media not supported", "媒体类型不支持"));
		errormap.put(50018, new StatusError(50018, "request method not support", "请求方法不支持"));
		errormap.put(50019, new StatusError(50019, "server error", "服务端异常"));
		errormap.put(50020, new StatusError(50020, "template auditing", "模板审核中"));
		errormap.put(50021, new StatusError(50021, "template not pass", "模板审核不通过"));
		errormap.put(50022, new StatusError(50022, "parameters not all replaced", "模板中参数未全部替换"));
		errormap.put(50023, new StatusError(50023, "parameters is empty", "参数为空"));
		errormap.put(50024, new StatusError(50024, "unsubscribed mobile", "手机号已退订"));
		errormap.put(50025, new StatusError(50025, "wrong template type", "该API不支持此模版类型"));
		errormap.put(50026, new StatusError(50026, "wrong msg_id", "msg_id 无效"));
	}

	/**
	 * 获取异常信息中文
	 * 
	 * @param code
	 * @return
	 */
	public static String getErrorCn(int code) {
		if (errormap.containsKey(code)) {
			return errormap.get(code).getCn();
		}
		return "";
	}

	/**
	 * 获取异常信息英文
	 * 
	 * @param code
	 * @return
	 */
	public static String getErrorEn(int code) {
		if (errormap.containsKey(code)) {
			return errormap.get(code).getCn();
		}
		return "";
	}
}
